"use strict";

var router = require("router"),
    TokenService = require("router").TokenService,
    mongo = require('./core/mongoservice'),
    ObjectId = require('mongodb').ObjectID,
    Q = require('q');

function ShopCreationService() {
    console.log("ShopCreationService constructor");
}
ShopCreationService.prototype = Object.create(TokenService.prototype);
ShopCreationService.prototype.constructor = ShopCreationService;


ShopCreationService.prototype.empty = function (request, response, promise) {
    return promise.then(function (self) {
        return self.getShopModel().then(function (shop) {
            return response.send({ request: request, content: shop });
        });
    });
};

/*-------------------------------------------------------*/
/*mongo daf*/
ShopCreationService.prototype.getShopModel = function () {
    return Q.fcall(function () {
        return {
            description: "",
            name: "",
            login: "",
            location: {
                address: "",
                city: "",
                postal_code: "",
                loc: {
                    type: "Point",
                    coordinates: []
                },
                neighborhood: null
            },
            contact: {
                tel: "",
                email: ""
            },
            categories: [],
            tags: [],
            front: {
                src: "/api/image/shop/front/default"
            },
            picto: {
                src: "/api/image/shop/picto/default"
            },
            dates: {
                creation: null
            },
            users: {
                subscribers: [],      /*utilisateur abonnés à la boutique*/
                near: [],             /*utilisateur proche de la boutique*/
                employees: []        /*utilisateur travaillant dans laboutique*/
            },
            shops: {
                subscriptions: [],    /*liste de boutique abonnées*/
                subscribers: [],      /*boutique abonnés à la boutique*/
                near: []              /*boutique proche de la boutique*/
            },
            alerts: {
                total: 0,
                alive: []
            }
        };
    });
};


exports = module.exports = new ShopCreationService();